package com.tuozixuan.camel.process;

import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;

@Component
public class ProcessorDemoRoute extends RouteBuilder {

	@Override
	public void configure() {
	    // 使用匿名类作为处理器
//        from("timer:firedOnceTimer?repeatCount=1").setBody().constant("Set Body")
//            .process(new Processor() {
//
//                @Override
//                public void process(Exchange exchange) throws Exception {
//                    System.out.println("process:" + exchange.getMessage().getBody());
//                }
//            })
//            .to("log:hello");
        
	    // 使用自定义处理器
//        from("timer:firedOnceTimer?repeatCount=1").setBody().constant("Set Body")
//            .process(new CustomProcessor())
//            .to("log:hello");
        
	    // 使用Bean Id指定处理器
//        from("timer:firedOnceTimer?repeatCount=1").setBody().constant("Set Body")
//            .process("customProcessor")
//            .to("log:hello");
	}

}
